package com.mlnx.bptp.body;

/**
 * @author zzb
 * @create 2019/3/26 16:40
 */
public enum  PacketType {
    BP_PACKET(0, "bp数据包"), REG_PACKET(1, "注册包"),PING_PACKET(2,"心跳包"),
    SET_TIME_PACKET(4,"设置检测时间"),ASK_DEVICE_PACKET(5,"询问deviceID"),
    SET_STATE_PACKET(6,"设置检测设置是否启动"),START_DETECT(7,"开启测量"),STOP_DETECT(8,"停止测量")
    ,SET_RECTIFY_TIME(9,"矫正时间"),DELETE_RECORD(10,"清空记录"),PROGRAMMING(11,"重新编程")
    ,ELECTRIC(12,"电量"),TOTAL_NUM(13,"获取某时段后记录数"),ASK_RECROD(14,"询问设备指定血压数据");

    private int code;
    private String description;

    private PacketType(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static PacketType decode(int code) {
        PacketType[] commands = PacketType.values();
        for (int i = 0; i < commands.length; i++) {
            if (code == commands[i].code)
                return commands[i];
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }




}
